/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.crossriver.crgis.database.service.http;

import com.crossriver.crgis.database.model.Property_Information;

import com.liferay.portal.kernel.json.JSONArray;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.util.StringPool;

import java.util.Date;
import java.util.List;

/**
 * @author    Wole Adetiba
 * @generated
 */
public class Property_InformationJSONSerializer {
	public static JSONObject toJSONObject(Property_Information model) {
		JSONObject jsonObj = JSONFactoryUtil.createJSONObject();

		jsonObj.put("applicationId", model.getApplicationId());
		jsonObj.put("userId", model.getUserId());
		jsonObj.put("propertyType", model.getPropertyType());
		jsonObj.put("blockNo", model.getBlockNo());
		jsonObj.put("plotNo", model.getPlotNo());
		jsonObj.put("area", model.getArea());
		jsonObj.put("uom", model.getUom());
		jsonObj.put("landLocation", model.getLandLocation());
		jsonObj.put("city", model.getCity());
		jsonObj.put("state", model.getState());
		jsonObj.put("country", model.getCountry());

		Date origCofODate = model.getOrigCofODate();

		String origCofODateJSON = StringPool.BLANK;

		if (origCofODate != null) {
			origCofODateJSON = String.valueOf(origCofODate.getTime());
		}

		jsonObj.put("origCofODate", origCofODateJSON);
		jsonObj.put("otherUsefulInformation", model.getOtherUsefulInformation());
		jsonObj.put("allocationMadToYou", model.getAllocationMadToYou());
		jsonObj.put("assignedToYou", model.getAssignedToYou());
		jsonObj.put("locationType", model.getLocationType());
		jsonObj.put("lga", model.getLga());
		jsonObj.put("town", model.getTown());
		jsonObj.put("village", model.getVillage());
		jsonObj.put("term", model.getTerm());
		jsonObj.put("estDevCost", model.getEstDevCost());

		Date estStartDate = model.getEstStartDate();

		String estStartDateJSON = StringPool.BLANK;

		if (estStartDate != null) {
			estStartDateJSON = String.valueOf(estStartDate.getTime());
		}

		jsonObj.put("estStartDate", estStartDateJSON);

		return jsonObj;
	}

	public static JSONArray toJSONArray(
		com.crossriver.crgis.database.model.Property_Information[] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Property_Information model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		com.crossriver.crgis.database.model.Property_Information[][] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Property_Information[] model : models) {
			jsonArray.put(toJSONArray(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		List<com.crossriver.crgis.database.model.Property_Information> models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Property_Information model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}
}